import { h } from 'vue';
import { NImage } from 'naive-ui';
import { NTag } from 'naive-ui';
import { BasicColumn } from '@/components/Table';

export const columns: BasicColumn[] = [
  {
    type: 'selection',
  }, {
    title: '序号',
    key: 'id',
    align: "center",
    width: 100
  }, {
    title: '门店名称',
    key: 'name',
    align: "center",
    width: 100
  }, {
    title: '门店类型',
    key: 'store_name',
    align: "center",
    width: 100
  }, {
    title: '联系人',
    key: 'lxname',
    align: "center",
    width: 100
  }, {
    title: '联系电话',
    key: 'phone',
    align: "center",
    width: 120
  }, {
    title: '订单数',
    key: 'ordercount',
    align: "center",
    width: 100
  }, {
    title: '实收金额',
    key: 'shishoumoney',
    align: "center",
    width: 100
  }, {
    title: '免押服务',
    key: 'depositstatus',
    align: "center",
    width: 100,
    render(row) {
      if (row.depositstatus == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('开启'),
          },
        );
      } else if (row.depositstatus == 0) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('关闭'),
          },
        );
      }
    }
  }, {
    title: '充电宝权限',
    key: 'powerbank',
    align: "center",
    width: 100,
    render(row) {
      if (row.powerbank == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('开启'),
          },
        );
      } else if (row.powerbank == 0) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('关闭'),
          },
        );
      }
    }
  }, {
    title: '充电线、盒子权限',
    key: 'chargingline',
    align: "center",
    width: 140,
    render(row) {
      if (row.chargingline == 1) {
        return h(
          NTag,
          {
            type: 'success',
          },
          {
            default: () => ('开启'),
          },
        );
      } else if (row.chargingline == 0) {
        return h(
          NTag,
          {
            type: 'error',
          },
          {
            default: () => ('关闭'),
          },
        );
      }
    }
  }, {
    title: '所属代理商',
    key: 'charger_agents_name',
    align: "center",
    width: 140
  }, {
    title: '所属员工',
    key: 'charger_yuangong_name',
    align: "center",
    width: 140
  }, {
    title: '所属商户',
    key: 'charger_bussiness_name',
    align: "center",
    width: 140
  }, {
    title: '门店图片',
    key: 'sitepicture',
    align: "center",
    width: 100,
    render(row) {
      return h(
        NImage,
        {
          width: 60,
          height: 60,
          src: row.sitepicture
        },
      );
    },
  }, {
    title: '创建时间',
    key: 'create_time',
    align: "center",
    width: 160
  }
];
